Component({
  /**
   * 组件的属性列表
   */
  properties: {
    userState: {
      type: Object,
      value: {}
    },
  },
  ready: function () { 
    this.getDate()
  },
  /**
   * 组件的初始数据
   */
  data: {
    weekArr: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
    date: {
      week: '',
      month: ''
    },
    preWeek: '',
    nextWeek: ''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    getDate () {
      this.setData({
        'date.week': this.data.weekArr[new Date().getDay()],
        'date.month': (new Date().getMonth() + 1) + '月' + new Date().getDate() + '日',
        preWeek: this.data.weekArr[(new Date().getDay() - 1) < 0 ? 6 : (new Date().getDay() - 1)],
        nextWeek: this.data.weekArr[(new Date().getDay() + 1) > 6 ? 0 : (new Date().getDay() + 1)],
      })
    }
  }
})
